<?php
    session_start();
    if(isset($_SESSION['admin'])){
        require_once("../model/User.php");
        $result = array();
        $objUser = new User();
        $consulta=$objUser->userListar();
        foreach ($consulta as $listar){
            array_push( $result, $listar);
        }
        echo json_encode($result);
    }else{
        header("Location: index.php");
    }
?>